1. Field of the Invention
The present invention relates to an arithmetic decoding system, and particularly to an arithmetic decoding device that decodes data coded by a context-adaptive binary arithmetic coding (CABAC) system.
2. Description of the Related Art
The context-adaptive binary arithmetic coding (CABAC) system is one of entropy coding systems in H.264 standardized at the ITU-T (International Telecommunication Union-Telecommunication standardization sector). In this CABAC, various kinds of multilevel data are binarized by being represented by symbols of “0” or “1” before coding. The binarized data is coded by a binary arithmetic coding process. The reverse of the process is performed at a time of decoding (decode).
The binary arithmetic coding process further converts the data represented by the symbols of “0” or “1” from {0, 1} to {LPS, MPS}, with a symbol estimated to have a higher probability of occurrence as a most probable symbol (MPS) and with a symbol other than the MPS as a least probable symbol (LPS). Then, the binary data represented by the two symbols of the LPS or the MPS is coded by arithmetic coding. Whether the MPS is “0” or “1” is predicted and determined for each symbol on the basis of processed data. That is, at a time of coding (encode), the MPS value of the symbol to be coded next is determined from only coded data, and at a time of decoding, the MPS value of the symbol to be decoded next is determined from only decoded data.
In addition, the binary arithmetic coding process is performed while a probability model suitable to a current state is sequentially selected from among a plurality of probability models (contexts) prepared in advance. In CABAC, context variables corresponding to respective contexts are stored in a context variable table, and a context variable context[ctxIdx] is identified by a context index (ctxIdx). There are a total of 460 context variables necessary for CABAC decoding of H.264. That is, the context index (ctxIdx) indicates a value of “0” to “459.” Relation between each context variable and the context index is as shown in FIGS. 47 to 49.
Each context variable is formed by a value of seven bits composed of a probability state index pStateIdx of six bits indicating a probability of occurrence and valMPS of one bit indicating a most probable symbol (MPS) having a high probability of occurrence. pStateIdx indicates an estimated value of a probability of occurrence of an LPS in the context by a probability state of “0” to “63” defined in advance. valMPS indicates whether a symbol corresponding to the MPS is “0” or “1.”
A CABAC decoder selects one context variable, and decodes one bin (one bit of binary data) on the basis of the context variable. The context variable is updated by the decoded bin. In the CABAC decoder, a decoding method is defined for each parameter for forming a macroblock. This parameter is referred to as a syntax element (SE). One syntax element is decoded by obtaining the multilevel data of the syntax element for a plurality of bins decoded using a plurality of context variables according to a multilevel conversion method determined for each syntax element.
When one bin is decoded, a bin whose context index is determined by the value of an immediately preceding decoded bin is often present at the head or an intermediate position of each syntax element in ascending order of the context index. The length of bins of each syntax element is often undetermined until an immediately preceding bin is decoded. Thus, also when the decoding of one syntax element is ended and another syntax element is decoded, the context index is undetermined until an immediately preceding bin is decoded. Further, in decoding one syntax element, the context variable of a same context index may be used consecutively, or the context variable of a different context index may be used each time.
For example, FIG. 50 is a diagram showing a flow of decoding of “mb_type” when a slice type is a B slice. There is a process of determining whether a first context index starts at “27,” “28,” or “29,” and thereafter a branch to take changes depending on an immediately preceding decoding result. A label of “0” or “1” indicates a bin as an immediately preceding decoding result, and the process of each branch is performed according to the label. A process without a branch label is performed irrespective of an immediately preceding bin. A number in a circle is a context index.
In addition, the number of context variables assigned to each syntax element is various. The context indexes of context variables of a same syntax element are close values, and are arranged in ascending order starting with a context index used first. However, syntax elements whose context indexes are close values are not necessarily arranged in order in which the syntax elements are decoded.
Consideration will be given to a case where context variables are managed as a sequence arranged in order of the context indexes in memory, read from a processor, and processed. When a plurality of context variables are accessed in bloc in a unit of 32 bits or the like, and are assigned to a same syntax element, the context variables are arranged close to each other, so that the number of times of memory access is reduced and a relatively high efficiency is obtained. When the context variables of a plurality of syntax elements are accessed simultaneously in a large unit such as 128 bits to further reduce the number of times of access, another syntax element taken in simultaneously is not necessarily decoded immediately, so that efficiency is degraded.
Suppose that in order to reduce an occupied amount of memory, context variables are arranged in units of eight bits without a gap in order of the context indexes. Because the largest number of context variables of a syntax element is 15, one syntax element can be contained with 128 bits (8 bits×15=120 bits). On the other hand, when syntax elements are arranged astride an alignment boundary of 128-bit units, one time of memory access in a unit of 128 bits does not suffice for a same syntax element.
For more efficient operation of the CABAC decoder, a short latency of access to context variables is desirable, and changes in access latency due to factors other than a CABAC decoding process make it difficult to ensure decoding process speed performance and are thus undesirable. It is therefore ideal to store context variables in a dedicated storage area. However, it is not practical to implement all the dedicated storage area as a flip-flop register in order to store 460 context variables because of too large a circuit scale. Thus the dedicated storage area is implemented by a SRAM (Static Random Access Memory) or the like. When a SRAM is used, the latency of access to context variables is increased, and therefore CABAC decoding process speed is lowered. As a technique for solving this, a moving image processing device has been proposed which processes a syntax element with a high frequency of occurrence using context variables retained in a memory with a small access latency, for example (see Japanese Patent Laid-Open No. 2007-300517 (FIG. 1), for example).